﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Messaging;

namespace MSMQTest
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string mqPath = @"FormatName:Direct=TCP:192.168.0.223\private$\myQueue";
            MessageQueue mq = new MessageQueue(mqPath);
            //Message ms = new Message();
            //ms.Label = "测试时间：" + DateTime.Now.ToShortDateString();
            //ms.Body = "testtesttest";
            
            //ms.Recoverable = true;
            ////ms.Formatter = new XmlMessageFormatter(new Type[] { typeof(string) });
            //mq.Send(ms);

            mq.Receive();
        }
    }
}
